import unittest
import config
import requests

from api.login_xhx import LoginXhx
from utils import common_assert


class XhxLogin(unittest.TestCase):
    def setUp(self):
        self.session = requests.session()

    def tearDown(self):
        self.session.close()

    def test01_xhx_login(self):
        loginxhx = LoginXhx()
        response = loginxhx.login_Xhx(self.session)
        print(response.json())
        response_json = response.json().get("data")
        print(response_json)
        self.assertEqual(0, response.json().get("error"))
        if response_json:
            config.TOKEN_RESULT[0]["xhx_token"]["xhxtoken"] = response_json
            print(config.TOKEN_RESULT)
        else:
            print("未获得xhxtoken令牌")
